package cn.hyy.hrm;

import cn.hyy.basic.util.AjaxResult;
import cn.hyy.hrm.impl.RedisClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *
 * 设置Feign的Client接口的时候
 *
 * 参数具体要添加注解
 * @RequestParam
 * @RequsetBody
 * @PathVariable
 *
 *
 */
@FeignClient(value = "CACHE-SERVICE",fallback = RedisClientImpl.class)
public interface RedisClient {

    /**
     * 设置字符值
     * @param key
     * @param value
     * @return
     */
    @GetMapping("/redis/setStr")
    AjaxResult setStr(@RequestParam("key") String key, @RequestParam("value") String value);


    /**
     * 获取字符值
     * @param key
     * @return
     */
    @GetMapping("/redis/getStr")
    AjaxResult getStr(@RequestParam("key") String key);

    /**
     * 设置字符值（有过期时间）
     * @param key
     * @param value
     * @return
     */
    @GetMapping("/redis/setStrEX")
    AjaxResult setStrEX(@RequestParam("key") String key, @RequestParam("value") String value,@RequestParam("seconds")Integer seconds);
    /**
     * 判断key值是否存在
     * @param key
     * @return
     */
    @GetMapping("/redis/exists")
    AjaxResult exists(@RequestParam("key") String key);

}
